package com.example.sourcesprng._initialization;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

@Service
public class InitializationService implements InitializingBean {

    private String name;
    private int age;

    public void say() {
        System.out.println("InitializationService.say()");
    }

    @PostConstruct
    public void postConstruct() {
        System.out.println("InitializationService.postConstruct()");
    }


    @Override
    public void afterPropertiesSet() throws Exception {
        this.name = "345";
        this.age = 18;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
